# Blocks

Blocks are objects which can be placed on an Adafruit IO Dasboard for a user.
Blocks IO range from input blocks (sliders and buttons) to output blocks (such as maps or other visual displays).

## All blocks

> HTTP Request
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks</code></div>

```shell
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
[
  {
    "name": "string",
    "description": "string",
    "key": "string",
    "visual_type": "string",
    "column": 0,
    "row": 0,
    "size_x": 0,
    "size_y": 0,
    "block_feeds": [
      {
        "id": "string",
        "feed": null,
        "group": null
      }
    ]
  }
]
```

An array of blocks


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
dashboard_id | string | true |



## Create a Block

> HTTP Request
> <div class="http"><span class="method-post">POST</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks</code></div>

```shell
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
{
  "name": "string",
  "description": "string",
  "key": "string",
  "visual_type": "string",
  "column": 0,
  "row": 0,
  "size_x": 0,
  "size_y": 0,
  "block_feeds": [
    {
      "id": "string",
      "feed": null,
      "group": null
    }
  ]
}
```

New Block


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
dashboard_id | string | true |


### Body Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
block | object | true |



## Returns Block

> HTTP Request
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks/{id}</code></div>

```shell
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
{
  "name": "string",
  "description": "string",
  "key": "string",
  "visual_type": "string",
  "column": 0,
  "row": 0,
  "size_x": 0,
  "size_y": 0,
  "block_feeds": [
    {
      "id": "string",
      "feed": null,
      "group": null
    }
  ]
}
```

Block response


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
dashboard_id | string | true |
id | string | true |



## Replace A Block

> HTTP Request
> <div class="http"><span class="method-put">PUT</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks/{id}</code></div>

```shell
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
{
  "name": "string",
  "description": "string",
  "key": "string",
  "visual_type": "string",
  "column": 0,
  "row": 0,
  "size_x": 0,
  "size_y": 0,
  "block_feeds": [
    {
      "id": "string",
      "feed": null,
      "group": null
    }
  ]
}
```

Updated block


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
dashboard_id | string | true |
id | string | true |


### Body Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
block | object | true |



## Delete a Block

> HTTP Request
> <div class="http"><span class="method-delete">DELETE</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks/{id}</code></div>

```shell
```

```python
```

```cpp
```

```ruby
```

> Response Sample:

```json
"string"
```

Deleted Block successfully


### Path Parameters

Parameter |   Type  |  Required |       Description
--------- | ------- | --------- | -----------------------
username | string | true | a valid username string
dashboard_id | string | true |
id | string | true |


